<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta name="domain" content="<?=domain?>" />
<link href="<?=domain?>static/style/manage.css" rel="stylesheet" type="text/css" />
<link href="<?=domain?>static/style/fancybox.css" rel="stylesheet" type="text/css" />
<link href="<?=domain?>static/style/datepicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=domain?>static/scripts/core.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/fancybox.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/datepicker.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/manage.js" charset="utf-8"></script>
<title><?=name?></title>
<body class="hoariness">
<div class="head">
	<div class="area">
		<div class="logo">12306抢票系统</div>
		<div class="parent">
			<div class="nav">
				<ul>
					<?php
						foreach($menu as $key=>$value){
							echo '<li><a href="'.domain.'index.php?c='.$value['child'][0]['controller'].'&a='.$value['child'][0]['method'].'" class="'.(stristr($value['controller'],$this->request['controller'])?'sel':'').'">'.$value['name'].'</a></li>';
						}
					?>
	    		</ul>
			</div>
			<div class="user">欢迎您&nbsp;<?=$name?>&nbsp;,<a href="<?=domain?>index.php?c=manage&a=out">【退出】</a></div>
		</div>
	</div>
	<div class="child">
		<div class="nav">
			<?php
				$controller=0;$method=0;
				foreach($menu as $k=>$v){
					if(stristr($v['controller'],$this->request['controller'])){
						$controller=$k;
						echo '<ul class="sel '.$v['controller'].'">';
					}else{
						echo '<ul class="'.$v['controller'].'">';
					}
					foreach($v['child'] as $key=>$value){
						if($value['method']==$this->request['method']&&$value['controller']==$this->request['controller']){
							$method=$key;
						}
						echo '<li class="'.$value['method'].'"><a href="'.domain.'index.php?c='.$value['controller'].'&a='.$value['method'].'">'.$value['name'].'</a></li>';
					}
					echo '</ul>';
				}
			?>
		</div>
		<div class="place">当前位置:<?=$menu[$controller]['name']?>&nbsp;>&nbsp;<?=$menu[$controller]['child'][$method]['name']?></div>
	</div>
</div>
<div class="work">
	<div class="form">
		<h3 class="reallynow">
           <span><?=$menu[$controller]['child'][$method]['name']?></span>
           <?php if($role==1){?>
		<form name="home" method="GET" action="<?=domain?>index.php" accept-charset="UTF-8">
  		<input type="hidden" name="c" value="subscribe"/><input type="hidden" name="a" value="index"/>
           <div class="x m select">
           		<a href="#"><label>设置搜索条件</label><span></span></a>
           		<div class="box">
					<div class="line">
						<div class="a">日期:</div>
						<div class="b"><input type="text" name="leave" value="<?=(isset($leave)&&count($leave)==2?$leave[0].','.$leave[1]:'');?>" size="23"/></div>
					</div>
		   			<div class="line">
		   				<div class="a">状态:</div>
		   				<div class="b">
		   					<label><input type="checkbox" name="locked[]" value="0"<?=(!isset($locked)||isset($locked[0])?' checked':'')?>/><span>成功</span></label>
		   					<label><input type="checkbox" name="locked[]" value="1"<?=(!isset($locked)||isset($locked[1])?' checked':'')?>/><span>待审核</span></label>
		   					<label><input type="checkbox" name="locked[]" value="2"<?=(!isset($locked)||isset($locked[2])?' checked':'')?>/><span>已审核</span></label>
		   					<label><input type="checkbox" name="locked[]" value="3"<?=(!isset($locked)||isset($locked[3])?' checked':'')?>/><span>预定中</span></label><br/><br/>
		   					<label><input type="checkbox" name="locked[]" value="4"<?=(!isset($locked)||isset($locked[4])?' checked':'')?>/><span>失败</span></label>
		   					<label><input type="checkbox" name="locked[]" value="10"<?=(!isset($locked)||isset($locked[10])?' checked':'')?>/><span>无效</span></label>
		   				</div>
		   			</div>
		   		</div>
           </div>
           <span class="s"><input type="text" name="search" value="<?=$search?>" size="13" maxlength="60" search="true"/></span>
           <div class="h select">
	           	<a href="#"><label>姓名</label><input type="hidden" name="tab" value="name" search="true"/><span></span></a>
	           	<ul>
<?php if($role==1){?><li tab="member"<?=($tab=='member'?' selected':'')?>><a href="#">会员</a></li><?php }?>
				  <li tab="train"<?=($tab=='train'?' selected':'')?>><a href="#">车次</a></li>
				  <li tab="name"<?=($tab=='name'?' selected':'')?>><a href="#">姓名</a></li>
				  <li tab="number"<?=($tab=='number'?' selected':'')?>><a href="#">证件号</a></li>
		   		</ul>
           </div>
           <span class="b"><input type="submit" name="filter" value="搜索" class="yellow"/></span>
           </form>
           <?php }?>
           <?php if(isset($purview['subscribe']['append'])){?><a fancybox="width:500,height:590" href="<?=(domain.'index.php?c=subscribe&a=append')?>" class="hd add">新建预订</a><?php }?>
        </h3>
		 <table class="fix">
			<thead>
				<tr>
					<th><input type="checkbox" name="all" value="" id="input_all"/></th>
<?php if($role==1){?><th>会员</th><?php }?>
					<th>登陆名</th>
					<th>车次</th>
					<th><a href="<?=$basic?>&order=frae&rule=<?=($rule=='desc'&&$order=='frae'?'asc':'desc')?>">始发</a><?php if($order=='frae'){?><span class="<?=$rule?>"></span><?php }?></th>
					<th>目地</th>
					<th><a href="<?=$basic?>&order=leave&rule=<?=($rule=='desc'&&$order=='leave'?'asc':'desc')?>">乘坐日期</a><?php if($order=='leave'){?><span class="<?=$rule?>"></span><?php }?></th>
					<th style="width:52px;">起售</th>
					<th>席别</th>
					<th>姓名</th>
					<th>证件号码</th>
					<!--<th>新建时间</th>-->
					<th><a href="<?=$basic?>&order=locked&rule=<?=($rule=='desc'&&$order=='locked'?'asc':'desc')?>">状态</a><?php if($order=='locked'){?><span class="<?=$rule?>"></span><?php }?></th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php
					foreach($subscribe as $key=>$value){
				?>
				<tr>
					<td><input type="checkbox" name="subscribe[]" value="<?=$value['id']?>"/></td>
<?php if($role==1){?><td><?=$value['member']?></td><?php }?>
					<td><?=$value['user']?></td>
					<td><?=$value['train']?></td>
					<td><?=$sortname[$value['frae']]['name']?></td>
					<td><?=$sortname[$value['to']]['name']?></td>
					<td><?=date('Y-m-d',$value['leave'])?></td>
					<td<?php if(isset($purview['subscribe']['leave'])){?> class="edit" mixed="id:<?=$value['id']?>"<?php }?>><?=date('H:00',$value['leave'])?></td>
					<td><?=$sortname[$value['seat']]['name']?></td>
					<td><?=$value['name']?></td>
					<td><?=$value['number']?></td>
					<!--<td><?=date('Y-m-d',$value['date'])?></td>-->
					<td<?php if($value['locked']==4||$value['locked']==0){echo' title="'.$value['remark'].'"';}?>><?=$value['locked']==0?'成功':($value['locked']==1?'审核中':($value['locked']==2?'已审核':($value['locked']==3?'预定中':($value['locked']==4?'失败':'无效'))))?></td>
					<td>
						<?php if(isset($purview['subscribe']['ticket'])){?><a fancybox="width:600,height:490" href="<?=(domain.'index.php?c=subscribe&a=ticket&subscribe='.$value['id'])?>">建议</a>&nbsp;<?php }?>
						<?php if(isset($purview['subscribe']['edit'])){?><a fancybox="width:500,height:590" href="<?=(domain.'index.php?c=subscribe&a=edit&subscribe='.$value['id'])?>">编辑</a>&nbsp;<?php }?>
						<?php if(isset($purview['subscribe']['locked'])){?><a href="<?=(domain.'index.php?c=subscribe&a=locked&subscribe='.$value['id'])?>" action="RequestA" mixed="sub:{locked:<?=($value['locked']==10||$value['locked']==1?2:10)?>}"><?=($value['locked']==10||$value['locked']==1?'通过':'无效')?></a>&nbsp;<?php }?>
						<?php if(isset($purview['subscribe']['wipe'])){?><a href="<?=(domain.'index.php?c=subscribe&a=wipe&subscribe='.$value['id'])?>" action="RequestA" mixed="confirm:true">删除</a><?php }?>
					</td>
				</tr>
				<?php
					}
				?>
			</tbody>
		</table>
		<div class="batch">
			<span><label for="input_all">全选</label></span>
			<?php if(isset($purview['subscribe']['wipe'])){?><span><a href="<?=(domain.'index.php?c=subscribe&a=wipe')?>" action="RequestBa">批量删除</a></span><?php }?>
			<?php if(isset($purview['subscribe']['locked'])){?><span><a href="<?=(domain.'index.php?c=subscribe&a=locked&locked=2')?>" action="RequestBa">激活</a></span><?php }?>
			<?php if(isset($purview['subscribe']['locked'])){?><span><a href="<?=(domain.'index.php?c=subscribe&a=locked&locked=10')?>" action="RequestBa">无效</a></span><?php }?>
		</div>
	</div>
	<div class="pagination"><?=$pagination?>&nbsp;&nbsp;<font>共<?=$total?>条记录</font></div>
</div>
<div class="footer">
	<div class="credits">Power by <a href="http://ticket.cnadlm.com" target="_blank">cnadlm</a></div>
	<div class="connect">
		<script src="http://s96.cnzz.com/stat.php?id=4920030&web_id=4920030" language="JavaScript">
	</div>
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
 $('input[name="leave"]').DatePicker({
	position:'bottom',
	calendars:2,
	mode:'range',
	onBeforeShow:function(){
		$('input[name="leave"]').parents('.select').attr('lock','true');
	},
	onChange:function(formated){
		formated=formated.toString();
		if(formated.indexOf('1970-01-01')==-1){
			$('input[name="leave"]').val(formated);
			$('input[name="leave"]').DatePickerHide();
		}
	},
	onHide:function(){
		$('input[name="leave"]').parents('.select').removeAttr('lock');
	}
});
</script>